package model

import "choujiang/common/db"

type UserGames struct {
	Id        int64 `xorm:"INT(11) not null pk autoincr"`
	UserId    int64 `xorm:"INT(11) not null default 0"`
	GameId    int64 `xorm:"INT(11) not null default 0"`
	Status    int64 `xorm:"INT(11) not null default 0"`
	CreatedAt int64 `xorm:"not null default 0 INT(11) created"`
	UpdatedAt int64 `xorm:"not null default 0 INT(11) updated"`
}

func (o *UserGames) Insert() (*UserGames, error) {
	_, err := db.MysqlEngine.InsertOne(o)
	return o, err
}

func (o *UserGames) Update() (*UserGames, error) {
	_, err := db.MysqlEngine.ID(o.Id).Update(o)
	return o, err
}
